|
|
|
|
|
|
|
A table (table-type recordset) is a direct link to one of the physical tables stored in the database. Because all data in a database is stored in tables, using this type of recordset provides the most direct link to the data. Tables are also the only form of recordset that supports indexes; therefore, searching a table for a specific record can be quicker than searching a dynaset or snapshot. |
|
|
|
|
|
|
|
|
When you are using tables, data is addressed or modified one table at a time, one record at a time. This arrangement provides very fine control over the manipulation of data. However, it does not give you the convenience of changing records in multiple tables with a single command, such as an action query. |
|
|
|
|
|
|
|
|
Advantages of Using Tables |
|
|
|
|
|
|
|
|
The use of tables in your programs gives you several advantages: |
|
|
|
|
|
|
|
|
You can use or create indexes to change the presentation order of the data in the table during program execution. |
|
|
|
|
|
|
|
|
You can perform rapid searches for an individual record using an appropriate index and the Seek command. |
|
|
|
|
|
|
|
|
Changes made to the table by other concurrent users or programs are immediately available. You do not need to ''refresh" the table to gain access to these records. |
|
|
|
|
|
|
|
|
Disadvantages of Using Tables |
|
|
|
|
|
|
|
|
Of course, using tables in your programs also poses disadvantages: |
|
|
|
|
|
|
|
|
You can't set filters on a table to limit the records being processed to those that meet certain criteria. |
|
|
|
|
|
|
|
|
You can't use the Find commands on a table; the Seek command finds only the first record that meets its criteria. This implies that, to process a series of records in a range, you, the programmer, must provide a means to find the additional records. |
|
|
|
|
|
|
|
|
You can usually overcome these disadvantages with programming, but the solutions are often less than elegant. This chapter discusses some of the workarounds in its coverage of the various methods for moving through a recordset and for finding specific records. These topics are covered later in this chapter. |
|
|
|
|
|
|
|
|
See "Positioning the Record Pointer," p. 576 |
|
|
|
|
|
|
|
|
To open a table for the program to use, define a Recordset object and then use your Database object's OpenRecordset method to access the table. To specify that a table-type recordset is to be created, use the dbOpenTable constant in the method's parameters. |
|
|
|
|
|
|
|
|
Follow these steps to create a table-type recordset named rsTitles in the sample application: |
|
|
|
|
|
|
|
|
1. Add the declaration Dim rsTitles as Recordset to the General Declarations section. |
|
|
|
|
|
|
|
|
2. Add the following line of code to the end of the form's Load event procedure: |
|
|
|
|
|
|
|
|
Set rsTitles = dbTest.OpenRecordset("titles", dbOpenTable) |
|
|
|
|
|